feat: support null-friendly parameters#52
Closed
vishalg0wda wants to merge 1 commit intoapideck-libraries:mainfrom
Closed
feat: support null-friendly parameters#52vishalg0wda wants to merge 1 commit intoapideck-libraries:mainfrom
vishalg0wda wants to merge 1 commit intoapideck-libraries:mainfrom
Conversation
Amzani
requested changes
Jul 14, 2025
Contributor
There was a problem hiding this comment.
Thanks @vishalg0wda for the PR, I’ll first need to assess the impact of this change on our existing customers before including it in the upcoming release.
Regarding the PR itself, it should only include changes to the gen.yaml file, since the actual SDK generation is managed by our CI pipeline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables the
nullFriendlyParametersfeature in Java SDK generation, significantly simplifying how SDK end users provide optional and nullable values.💡 What’s Changing
Prior to this change, end users had to wrap values explicitly:
With this feature enabled, users can now pass null directly:
This improves:
Developer experience – Cleaner, more idiomatic Java usage.
IDE feedback – JetBrains users get nullability hints via jakarta
@Nullable/@NonNullannotations.API cleanliness – Wrapper types like JsonNullable are handled internally and no longer leak into user code.
This introduces breaking changes to method signatures and generated types. Any SDKs regenerating with this flag enabled will break compatibility for existing consumers.
As such:
This change must be released behind a version bump (typically a major version).
🤔 PATCH Semantics and Null Handling
A common concern with this change is how
nullvalues behave in PATCH-like operations, where setting a field to null often carries different intent than omitting it entirely.To clarify:
✅ Nullable fields → passing null results in an explicit null being sent.
✅ Optional fields → passing null causes the field to be omitted from the request.
✅ Nullable + Optional fields → passing null results in null being sent; to omit, simply avoid calling the setter.
The generated SDK code handles this distinction under the hood, by converting values internally to the appropriate JsonNullable or JsonUndefined types - so users don’t have to manage those concerns themselves.